<?php

class Application_Form_AddNormalUser extends Zend_Form {

    public function init(){
            // Set the method for the display form to POST
        $this->setMethod('post');
 
        //Last Name element
        $this->addElement('text', 'last_name', array(
            'label'      => 'Nume:',
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array(
            	array('StringLength', false, array(0, 50)),
            )
        ));
        
        //First Name element
        $this->addElement('text', 'first_name', array(
        		'label'      => 'Prenume:',
        		'required'   => true,
        		'filters'    => array('StringTrim'),
        		'validators' => array(
        				array('StringLength', false, array(0, 50)),
        		)
        ));
        
        $this->addElement('text', 'email', array(
            'label'      => 'E-mail:',
            'required'   => true,
            'filters'    => array('StringTrim', 'StringToLower'),
            'validators' => array(
                'EmailAddress',
            	array('StringLength', false, array(0, 50)),
            )
        ));
                
        $pswd = new Zend_Form_Element_Password('password');
        $pswd->setLabel('Parola:');
        $pswd->setAttrib('size', 20);
        $pswd->setRequired(true);
        $pswd->addValidator('StringLength', false, array(4,15));
        $pswd->addErrorMessage('Parola trebuie sa fie intre 4 si 15 caractere!');
        
        $confirmPswd = new Zend_Form_Element_Password('confirm');
        $confirmPswd->setLabel('Confirma:');
        $confirmPswd->setAttrib('size', 20);
        $confirmPswd->setRequired(true);
        $confirmPswd->addValidator('Identical', false, array('token' => 'password'));
        $confirmPswd->addErrorMessage('Cele doua parole nu coincid');
        
        $this->addElement($pswd);
        $this->addElement($confirmPswd);
        
        $this->addElement('textarea', 'address', array(
        		'label'      => 'Adresa:',
        		'required'   => true,
        		'rows'=>'4',
        		'cols'=>'20',
        		'filters'    => array('StringTrim'),
        		'validators' => array(
        				array('StringLength', false, array(6, 150)),
        		),
        		'errorMessage'=> 'Adresa este un camp obligatoriu!'
        ));
          
        // Add the submit button
        $this->addElement('submit', 'submit', array(
            'ignore'   => true,
            'label'    => 'Creeaza cont!',
        ));
    }
}

